package org.gpswalker.sys.server.servlets;

import javax.jdo.PersistenceManager;

import org.gpswalker.sys.abstractions.AbstractHeaderWritingServlet;
import org.gpswalker.sys.server.misc.PMF;
import org.gpswalker.sys.server.users.CmsUser;
import org.gpswalker.sys.server.users.StoredUser;

public class ConfirmRegistration extends AbstractHeaderWritingServlet {
    private static final long serialVersionUID = -8880750532587956027L;

    @Override
    protected void arbeiten() {
	setTitle("RegistrationConfirmation");
	if ((!CmsUser.user().isAnonymous()) && (!CmsUser.user().isOurs())) {
	    String s = "";
	    PersistenceManager pm = PMF.getManager();
	    StoredUser su = CmsUser.user();
	    StoredUser stored = pm.makePersistent(su);
	    if (stored != null) {
		s += stored.idString();
	    }

	    dataModel
		    .put("html", s + " You were succcessfully added to the db");

	} else {
	    dataModel.put("html", "You needn't be here");
	}
    }

    @Override
    protected String templateName() {
	// TODO Auto-generated method stub
	return "emptyTemplate.ftl";
    }

}
